www.gusucode.com > 星梦奇缘交友网 1 > 星梦奇缘交友网 1.0源码程序/love/visual_sale.asp

    <!--#include file=conn.asp-->
<!--#include file="config.asp" -->
<!--#include file="const.asp" -->
<!--#include file="char.asp" -->
<!--#include file="Visual_const.asp" -->
<%
 '=========================================================
' File: visual_sale.asp
' Version:3.0
' Date: 2005-10-29
' Script Written by xmrxw
'=========================================================
' Copyright (C) 2004,2005 920520.com All rights reserved.
' Web: http://www.920520.com,http://www.xmzxw.com
' Email: info@mssky.com,super@mssky.com
' QQ:10689579 Msn:zdlmicr@hotmail.com
'=========================================================
dim CurItem,ItemName,rsvisual
dim Salefee,SalePrice,CurDate,SendMsg,SucFlag
dim MinPrice,CurType

founderr=false
if not founduser or membername=""  then
	SendMsg=SendMsg+"<br>"+"<li>您还没有<a href=login.asp>登录</a>,不能使用个人形象设计功能。如果您还没有<a href=reg.asp>注册</a>,请先<a href=reg.asp>注册</a>!"
	founderr=true
end if
if isnull(request("itemid")) or request("itemid")="" then
	SendMsg=SendMsg+"<br>"+"<li>没有指定商品编号!"
	founderr=true
else
	CurItem=CheckStr(request("itemid"))
	if not isnumeric(curitem) then
		SendMsg=SendMsg+"<br>"+"<li>提交的数据有错误!"
		founderr=true
	end if
end if

set rs=server.createobject("adodb.recordset")
sql="select top 1 * from visual_items where id="&CurItem
rs.open sql,conn,1,1
ItemName=rs("name")
CurType=rs("type") mod 100
if CurType>=5 then CurType=4
salefee=conn.execute("select top 1 sale from visual_config")(0)
minprice=int(rs("price1")*conn.execute("select top 1 salemin from visual_config")(0)/100+0.99)
rs.close
if request("action")="sale" then
	if isnull(Request("SalePrice")) or Request("SalePrice")="" then
		SendMsg=SendMsg+"<br>"+"<li>出售价格不可为空!"
		founderr=true
	else
		SalePrice=CheckStr(Request("SalePrice"))
		if not isInteger(SalePrice) then
			SendMsg=SendMsg+"<br>"+"<li>出售价格必须是整数!"
			founderr=true
		end if
		if clng(SalePrice)<=MinPrice then
			SendMsg=SendMsg+"<br>"+"<li>出售价格必须大于"&MinPrice&"!"
			founderr=true
		end if
		SalePrice=clng(SalePrice)
	end if
end if
call nav()
if founderr then
	call sale_Msg()
else
	CurDate=year(now())&"-"&month(now())&"-"&day(now())
	set rs=server.createobject("adodb.recordset")
	sql="select * from visual_myitems where itemid="&CurItem&" and username='"&membername&"'"
	rs.open sql,conn,1,1
	if rs.bof or rs.eof then
		if request("StopSale")=1 then
			SendMsg=SendMsg+"<br>"+"<li>您没有这个商品或该商品已被人购买,不能停售!"
		else
			SendMsg=SendMsg+"<br>"+"<li>您没有这个商品,不能出售!"
		end if
		founderr=true
	else
		if request("StopSale")=1 then
			if rs("type")<>5 then
				SendMsg=SendMsg+"<br>"+"<li>您尚未出售这个商品,不能停售!"
				founderr=true
			end if
		else
			if rs("type")=5 then
				SendMsg=SendMsg+"<br>"+"<li>您已经出售了这个商品,无须再次出售!"
				founderr=true
			end if
		end if
	end if
	rs.close
	set rs=nothing
	if request("action")="sale" then
		if int(saleprice*salefee/100+0.99)>mymoney then
			SendMsg=SendMsg+"<br>"+"<li>您的现金("&mymoney&" 元)不足,无法支付二手市场的手续费 "&int(saleprice*salefee/100+0.99)&" 元,出售失败!"
			founderr=true
		end if
	end if
	if founderr then
		call sale_Msg()
	else
		if request("stopsale")=1 then
			set rs=server.createobject("adodb.recordset")
			rs.open "select top 1 * from visual_myitems where username='"&membername&"' and itemid="&curItem,conn,1,3
			salefee=int(rs("salePrice")*salefee/100+0.99)
			rs("salePrice")=0
			rs("type")=CurType
			rs.update
			rs.close
			set rs=nothing
			conn.execute("delete from visual_events where ItemID="&CurItem&" and (UserName='' or isnull(username)) and FromUser='"&membername&"' and Type=2")
			conn.execute("update [Ms_user] set userwealth=userwealth+"&salefee&" where username='"&membername&"'")
			SendMsg="<li>已经取消了《<font color=blue>"&itemName&"</font>》的出售!"
			response.write "<script>"
			response.write "window.opener.document.execCommand('Refresh');"
			response.write "</script>"
			call sale_Msg()
		else
			if request("action")="sale" then
				set rs=server.createobject("adodb.recordset")
				rs.open "select top 1 * from visual_myitems where username='"&membername&"' and itemid="&curItem,conn,1,3
				rs("salePrice")=saleprice
				rs("type")=5
				rs.update
				rs.close
				set rs=nothing
				salefee=int(saleprice*salefee/100+0.99)
				conn.execute("insert into visual_events (ItemID,UserName,FromUser,DateAndTime,Price,Type) values ("&CurItem&",'','"&membername&"','"&curdate&"',"&saleprice&",2)")
				conn.execute("update [Ms_user] set userwealth=userwealth-"&salefee&" where username='"&membername&"'")
				SendMsg="<li>已经成功地出售了《<font color=blue>"&itemName&"</font>》,等待他人的购买!"
				response.write "<script>"
				response.write "window.opener.document.execCommand('Refresh');"
				response.write "</script>"
				call sale_Msg()
			else
			%>
				<table cellpadding=3 cellspacing=1 align=center  class=tableborder1>
				<form action="?" method=post name=fix>
				<input type=hidden name="action" value="sale">
					<tr> 
						<th colspan=4>出售形象商品 -- <%=ItemName%></th>
					</tr>
					<tr> 
						<td class=tablebody1 valign=middle><b>出售价格:</b></td>
						<td class=tablebody1 valign=middle><input class=2 type=text name="saleprice" size=10> 元</td>
	         <td class=tablebody1 valign=middle><textarea cols=50 rows=6 name="msgbody" title="Ctrl+Enter发送"><%=msgbody%></textarea></td>
         	<td rowspan=3 class=tablebody1 valign=middle baseName=images/img_visual/003.gif width="84" height="84" border="0" itemgender="" itemno=<%=CurItem%> layerno="" localpic=<%=LocalPic%> ImagePath="<%=PicPath%>" style="behavior:url(inc/NF_show2.htc)"></td>
					</tr>
					<tr> 
						<td class=tablebody1 colspan=4><b>说明</b>:<br>① 出售商品的最低价格为 <%=minPrice%> 元<br>② 出售商品每件收取成交价格的 <%=SaleFee%></td>
					</tr>
					<tr> 
						<td class=tablebody2 valign=middle colspan=4 align=center><input type=hidden name=itemid value=<%=CurItem%>><input class=2 type=Submit value="确定" name=Submit>&nbsp;<input class=2 type="button" name="close" value="关闭" onclick="window.close()"></td>
					</tr>
					</form>
				</table>
			<%end if
		end if
	end if
end if

sub sale_msg()%>
	<table cellpadding=3 cellspacing=1 align=center class=tableborder1>
		<tr align=center>
			<th width="100%">翻新形象商品信息</th>
		</tr>
		<tr>
			<td width="100%" class=tablebody1><b>操作结果:</b><br><%
				if founderr then
					response.write "<font>"
					response.write sendmsg
					response.write "</font>"
				else
					response.write sendmsg
				end if
			%></td>
		</tr>
				<tr align=center>
			<td width="100%" class=tablebody2><a href="javascript:window.close()">[关闭窗口]</a>&nbsp;&nbsp;<%if request("action")="sale" and founderr then%><a href="Visual_cartbag.asp">[返回购物袋]</a><%
				end if
			%></td>
		</tr>
	</table>
<%end sub%>